package com.stylefeng.guns.rest.common;

public class CurrentUser {

    //线程绑定存储空间
    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();

    public static void saveUserId(String userId){
        THREAD_LOCAL.set(userId);
    }

    public static String getCurrentUserId(){
        return THREAD_LOCAL.get();
    }

    //存储UserInfoModel的方式
//    public static void saveUserInfo(UserInfoModel userInfoModel){
//        THREAD_LOCAL.set(userInfoModel);
//    }
//
//    public static UserInfoModel getCurrentUser(){
//        return THREAD_LOCAL.get();
//    }
}
